package com.whmall.service.crm.module.companybusinesscertificate.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.whmall.service.crm.module.companybusinesscertificate.entity.CompanyBusinessCertificateDO;
import com.whmall.service.crm.module.companybusinesscertificate.entity.qo.CompanyBusinessCertificateQO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Set;

/**
 * Author：yangdong
 * Date：2020/8/3
 * Description：${DESCRIPTION}
 */
@Mapper
public interface CompanyBusinessCertificateMapper extends BaseMapper<CompanyBusinessCertificateDO> {

    List<CompanyBusinessCertificateDO> listBy(CompanyBusinessCertificateQO qo);

    CompanyBusinessCertificateDO getById(Long id);

    int insert(CompanyBusinessCertificateDO record);

    int update(CompanyBusinessCertificateDO record);

    int countEffective(@Param("id") Long id, @Param("companyId") Long companyId, @Param("certificateNumber") String certificateNumber);

    /**
     * 根据证照有效期重新验证有效性
     */
    void revalidateEffective();

    Integer validProductCount(Long id);

    Set<Long> findIdsByTodayExpire(@Param("today") Date today);

    List<CompanyBusinessCertificateDO> findIdsByTodayEffect(@Param("today") Date today);
}
